package com.wty.love.smallGames;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import com.wty.love.R;

public class SmallGamesActivity extends AppCompatActivity {

    private View flightChess;
    private View keyTone;
    private View view2048;
    private View othersGames;
    private View eatFlies;
    private View ticTacToe;
    private View rotateSix;
    private View noKill;
    private View cutBlocks;
    private View pin;
    private View mf;
    private View blackAndWhite;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_small_games);
        initView();
        initClick();
    }

    private void initView(){
        flightChess = findViewById(R.id.flightChess);
        keyTone = findViewById(R.id.keyTone);
        view2048 = findViewById(R.id.view2048);
        othersGames = findViewById(R.id.othersGames);
        eatFlies = findViewById(R.id.eatFlies);
        ticTacToe = findViewById(R.id.ticTacToe);
        rotateSix = findViewById(R.id.rotateSix);
        noKill = findViewById(R.id.noKill);
        cutBlocks = findViewById(R.id.cutBlocks);
        pin = findViewById(R.id.pin);
        mf = findViewById(R.id.mf);
        blackAndWhite = findViewById(R.id.blackAndWhite);
    }

    private void initClick(){
        flightChess.setOnClickListener(v->{
            Intent intent = new Intent(this,WebActivity.class);
            intent.putExtra(WebActivity.URL,WebActivity.flightChess);
            startActivity(intent);
        });
        keyTone.setOnClickListener(v->{
            Intent intent = new Intent(this,WebActivity.class);
            intent.putExtra(WebActivity.URL,WebActivity.keyTone);
            startActivity(intent);
        });
        view2048.setOnClickListener(v->{
            Intent intent = new Intent(this,WebActivity.class);
            intent.putExtra(WebActivity.URL,WebActivity.url2048);
            startActivity(intent);
        });
        othersGames.setOnClickListener(v->{
            Intent intent = new Intent(this,WebActivity.class);
            intent.putExtra(WebActivity.URL,WebActivity.othersGames);
            startActivity(intent);
        });
        eatFlies.setOnClickListener(v->{
            Intent intent = new Intent(this,WebActivity.class);
            intent.putExtra(WebActivity.URL,WebActivity.eatFlies);
            startActivity(intent);
        });
        ticTacToe.setOnClickListener(v->{
            Intent intent = new Intent(this,TicTacToeActivity.class);
            startActivity(intent);
        });
        rotateSix.setOnClickListener(v->{
            Intent intent = new Intent(this,WebActivity.class);
            intent.putExtra(WebActivity.URL,WebActivity.rotateSix);
            startActivity(intent);
        });
        noKill.setOnClickListener(v->{
            Uri uri = Uri.parse(WebActivity.noKill);
            Intent intent = new Intent(Intent.ACTION_VIEW, uri);
            startActivity(intent);
        });
        cutBlocks.setOnClickListener(v->{
            Intent intent = new Intent(this,WebActivity.class);
            intent.putExtra(WebActivity.URL,WebActivity.cutBlocks);
            startActivity(intent);
        });
        pin.setOnClickListener(v->{
            Intent intent = new Intent(this,WebActivity.class);
            intent.putExtra(WebActivity.URL,WebActivity.pin);
            startActivity(intent);
        });
        mf.setOnClickListener(v->{
            Uri uri = Uri.parse(WebActivity.mf);
            Intent intent = new Intent(Intent.ACTION_VIEW, uri);
            startActivity(intent);
        });
        blackAndWhite.setOnClickListener(v->{
            Uri uri = Uri.parse(WebActivity.blackAndWhite);
            Intent intent = new Intent(Intent.ACTION_VIEW, uri);
            startActivity(intent);
        });
    }
}